Skip to content

Bump go2rtc to 1.9.12 and go2rtc-client to 0.3.0#156948

Merged
edenhaus merged 1 commit into
devfrom
go2rtc-1.9.12
Nov 20, 2025
Merged

Bump go2rtc to 1.9.12 and go2rtc-client to 0.3.0#156948
edenhaus merged 1 commit into
devfrom
go2rtc-1.9.12

Conversation

@edenhaus
Copy link
Copy Markdown
Member

Breaking change

Proposed change

Release client: https://github.com/home-assistant-libs/python-go2rtc-client/releases/tag/0.3.0
Updated go2rtc to the latest version 1.9.12, where we can finally get the activated sources via API. This also required adding support for this new API call in the library,
Enable on the HA-hosted go2rtc only the module we really need

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@home-assistant
Copy link
Copy Markdown
Contributor

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (go2rtc) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of go2rtc can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign go2rtc Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

api_paths: tuple[str, ...] = _API_ALLOW_PATHS
api_ip = _LOCALHOST_IP
if enable_ui:
app_modules = _UI_APP_MODULES
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we could make a new tuple as a local variable here and add the tuple constants into the new tuple and only make the constants contain the separate features instead of making the constants contain all needed features.

@edenhaus edenhaus marked this pull request as ready for review November 20, 2025 18:40
Copilot AI review requested due to automatic review settings November 20, 2025 18:40
@edenhaus edenhaus requested a review from a team as a code owner November 20, 2025 18:40
@edenhaus
Copy link
Copy Markdown
Member Author

Test failure unrelated before restarting the failed jobs (now they fail as cache is already deleted)

@edenhaus edenhaus merged commit 126fd21 into dev Nov 20, 2025
119 of 124 checks passed
@edenhaus edenhaus deleted the go2rtc-1.9.12 branch November 20, 2025 18:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates go2rtc from version 1.9.11 to 1.9.12 and the go2rtc-client library from 0.2.1 to 0.3.0. The main purpose is to leverage the new API endpoint in go2rtc 1.9.12 that allows fetching activated/supported stream schemes dynamically, replacing the hardcoded list. Additionally, the PR implements security improvements by restricting the go2rtc server to only load necessary modules and API paths.

Key changes:

  • Replaces hardcoded _SUPPORTED_STREAMS list with dynamic scheme detection via schemes.list() API
  • Adds module and API path allowlisting to the go2rtc server configuration for security hardening
  • Updates tests to use snapshot testing for configuration validation

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
homeassistant/components/go2rtc/init.py Removes hardcoded stream schemes list, adds initialize() method to fetch schemes dynamically from API
homeassistant/components/go2rtc/server.py Adds module and API path restrictions to go2rtc config, refactors config generation
homeassistant/components/go2rtc/const.py Updates recommended version to 1.9.12
homeassistant/components/go2rtc/manifest.json Updates go2rtc-client requirement to 0.3.0
tests/components/go2rtc/test_server.py Refactors test to use snapshot testing for config validation
tests/components/go2rtc/snapshots/test_server.ambr Adds snapshots for both UI enabled/disabled configurations
tests/components/go2rtc/conftest.py Adds mock for schemes.list() returning supported scheme set
Dockerfile Updates go2rtc binary download URL to version 1.9.12
requirements files Updates go2rtc-client dependency version across all requirement files
script/hassfest/docker/Dockerfile Updates go2rtc-client version in hassfest Docker image

return False

provider = entry.runtime_data = WebRTCProvider(hass, url, session, client)
await provider.initialize()
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provider.initialize() call is not wrapped in error handling. If the schemes.list() API call fails, it will raise an unhandled exception and cause the config entry setup to fail without a proper error message or ConfigEntryNotReady exception.

Consider wrapping this call in a try-except block similar to the pattern used above for client.validate_server_version():

try:
    await provider.initialize()
except Go2RtcClientError as err:
    if isinstance(err.__cause__, _RETRYABLE_ERRORS):
        raise ConfigEntryNotReady(
            f"Could not connect to go2rtc instance on {url}"
        ) from err
    _LOGGER.warning("Could not initialize go2rtc provider on %s (%s)", url, err)
    return False
except Exception as err:  # noqa: BLE001
    _LOGGER.warning("Could not initialize go2rtc provider on %s (%s)", url, err)
    return False
Suggested change
await provider.initialize()
try:
await provider.initialize()
except Go2RtcClientError as err:
if isinstance(err.__cause__, _RETRYABLE_ERRORS):
raise ConfigEntryNotReady(
f"Could not connect to go2rtc instance on {url}"
) from err
_LOGGER.warning("Could not initialize go2rtc provider on %s (%s)", url, err)
return False
except Exception as err: # noqa: BLE001
_LOGGER.warning("Could not initialize go2rtc provider on %s (%s)", url, err)
return False

Copilot uses AI. Check for mistakes.
@edenhaus edenhaus added this to the 2025.11.3 milestone Nov 21, 2025
@frenck frenck mentioned this pull request Nov 21, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants